package testJob;

public class SQLJob extends ServerJob{
	//	4.SQLJob
	//		String IP
	//		int port
	//		String connectionString
	//		boolean connect()
	//		boolean disconnect()
	//		String sql
	//		void run()
	//		int[] result
	//		boolean ping(int timeout)
	//		int duration
	@Override
	public boolean connect() {
		System.out.printf("SQLJob is connecting! %s %d %s\n",this.getIP(),this.getPort(),this.getConnectString());
		return true;
	}
	
	public boolean disconnect() {
		System.out.printf("SQLJob is stoped! %s %d %s\n",this.getIP(),this.getPort(),this.getConnectString());
		return true;
	}
	
	private String sql;
	
	public void setSql(String sql) {
		this.sql = sql;
	}
	
	public String getSql() {
		return this.sql;
	}

	public SQLJob(String IP, int port, String connectionString) {
		super(IP, port, connectionString);
//		this.resetDuration();
	}
	public SQLJob(String IP, int port, String connectionString, String sql) {
		this(IP, port, connectionString);
		this.setSql(sql);
	}
	
	@Override
	public void run() {
		this.connect();
		this.disconnect();
		System.out.println("SQL Job is pretend runing!");
		this.setResult(new int[] {1,2,3,5});
		this.setDuration(5123);;
	}
	
	public boolean ping(int timeout) {
		System.out.printf("now is ping the server, IP: %s port: %d\n",this.getIP(),this.getPort());;
		return true;
	}
}
